package cn.com.pc.content.converter;

import cn.com.pc.content.domain.Site;
import org.springframework.core.convert.converter.Converter;

import java.util.Date;

/**
 * Spring MVC Site 转换
 */
public class SiteConverter implements Converter<String, Site> {
    @Override
    public Site convert(String s) {
        for (Site site : Site.values()) {
            if (site.getName().equalsIgnoreCase(s) || site.getFullname().equalsIgnoreCase(s)) {
                return site;
            }
        }
        return Site.Unknown;
    }
}